
package com.joysuch.wwyt.datadump.biz.model;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.zlg.common.datadump.annotation.DataDumpEntity;
import cn.zlg.common.datadump.annotation.DataDumpField;
import com.joysuch.wwyt.bp.entity.investigate.dsl.QBpInvestigateStore;
import com.joysuch.wwyt.bp.entity.investigate.dsl.QBpInvestigateStoreDetail;
import com.joysuch.wwyt.datadump.biz.convertor.ExportRecusiveGetParentPropConvertor;
import com.joysuch.wwyt.datadump.biz.processor.BpInvestigateStoreDetailImportProcessor;
import com.joysuch.wwyt.datadump.biz.query.BpInvestigateStoreDetailDumpQueryBean;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;

@DataDumpEntity(name = "bp-investigate-store-detail-dump", entity = QBpInvestigateStoreDetail.class,
        exportQueryConditions = BpInvestigateStoreDetailDumpQueryBean.class,
        importProcessors = BpInvestigateStoreDetailImportProcessor.class,
        businessName = "隐患标准库")
@Data
public class BpInvestigateStoreDetailDumpBean {

    @NotNull
    @Length(max = 512)
    @Excel(name = "排查内容", width = 20)
    @DataDumpField(field = "content", importKey = true)
    private String content;

    @NotNull
    @Length(max = 512)
    @Excel(name = "排查依据", width = 20)
    @DataDumpField(field = "accordance", importKey = true)
    private String accordance;

    @NotNull
    @Length(max = 64)
    @Excel(name = "当前标准库", width = 20)
    @DataDumpField(field = "storeId", referenceEntity = QBpInvestigateStore.class, referenceEntityField = "checkTypeName", importKey = true, importIgnore = true)
    private String storeName;

    @NotNull
    @Length(max = 64)
    // 采用递归获取上级对象的方式
    @Excel(name = "上级标准库", width = 20)
    @DataDumpField(field = "storeId", referenceEntity = QBpInvestigateStore.class, referenceEntityField = "parentId", exportConvertors = {
            ExportRecusiveGetParentPropConvertor.class }, exportConvertorParams = { "checkTypeName", "1" }, importIgnore = true)
    private String parentStoreName;

    @NotNull
    @Length(max = 64)
    @Excel(name = "上上级标准库", width = 20)
    @DataDumpField(field = "storeId", referenceEntity = QBpInvestigateStore.class, referenceEntityField = "parentId", exportConvertors = {
            ExportRecusiveGetParentPropConvertor.class }, exportConvertorParams = { "checkTypeName", "2" }, importIgnore = true)
    private String grandfatherStoreName;

}
